home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.app;
-
- import com.extensibility.rock.RAction;
- import java.awt.Window;
-
- public abstract class EditWindow extends BaseWindow {
- private String findText;
- private String replaceText;
-
- public EditWindow(BaseDocument var1) {
- super(var1);
- }
-
- public boolean commitPendingEdits(boolean var1) {
- return true;
- }
-
- protected void fillEditMenu() {
- this.createUndoAction().addToMenu(super.muEdit);
- this.createRedoAction().addToMenu(super.muEdit);
- super.muEdit.addSeparator();
- this.createCutAction().addToMenu(super.muEdit);
- this.createCopyAction().addToMenu(super.muEdit);
- this.createPasteAction().addToMenu(super.muEdit);
- this.createClearAction().addToMenu(super.muEdit);
- super.muEdit.addSeparator();
- this.createFindAction().addToMenu(super.muEdit);
- this.createFindAgainAction().addToMenu(super.muEdit);
- this.createReplaceAction().addToMenu(super.muEdit);
- this.createReplaceAgainAction().addToMenu(super.muEdit);
- super.muEdit.addSeparator();
- super.fillEditMenu();
- this.setEditEnable();
- }
-
- public void touch() {
- ((BaseWindow)this).getDocument().touch();
- }
-
- protected BaseAction createSaveToURLAction() {
- return new 1(this, "file.item.save.url");
- }
-
- protected BaseAction createCloseAction() {
- return new 2(this, "file.item.close", 'W');
- }
-
- protected RAction createUndoAction() {
- return ((BaseWindow)this).getDocument().getUndoManager().getUndoAction();
- }
-
- protected RAction createRedoAction() {
- return ((BaseWindow)this).getDocument().getUndoManager().getRedoAction();
- }
-
- protected RAction createCutAction() {
- return new 3((EditWindow)null, "edit.item.cut", 'X');
- }
-
- protected RAction createCopyAction() {
- return new 4((EditWindow)null, "edit.item.copy", 'C');
- }
-
- protected RAction createPasteAction() {
- return new 5((EditWindow)null, "edit.item.paste", 'V');
- }
-
- protected RAction createClearAction() {
- return new 6((EditWindow)null, "edit.item.clear", 'B');
- }
-
- protected RAction createFindAction() {
- return new 7(this, "edit.item.find", 'F');
- }
-
- protected RAction createFindAgainAction() {
- return new 8(this, "edit.item.find.again", 'G');
- }
-
- protected RAction createReplaceAction() {
- return new 9(this, "edit.item.replace", 'R');
- }
-
- protected RAction createReplaceAgainAction() {
- return new 10(this, "edit.item.replace.again", 'T');
- }
-
- protected RAction createSaveAction() {
- return new 11(this, "file.item.save", 'S');
- }
-
- protected RAction createSaveAsAction() {
- return new 12(this, "file.item.save.as");
- }
-
- protected abstract void setEditEnable();
-
- protected abstract boolean canFind();
-
- protected abstract void doFind(String var1, boolean var2);
-
- public abstract String getSelectedText();
-
- public abstract boolean setSelectedText(String var1);
-
- public void find() {
- String var1 = DialogFactory.askFind(this, this.findText);
- if (var1 != null && this.canFind()) {
- this.findText = var1;
- this.findAgain();
- }
-
- }
-
- public void findAgain() {
- if (this.findText == null) {
- this.find();
- } else if (this.canFind()) {
- this.doFind(this.findText, true);
- }
-
- }
-
- public void replace() {
- String[] var1 = DialogFactory.askReplace(this, this.findText, this.replaceText);
- if (var1 != null && this.canFind()) {
- this.findText = var1[0];
- this.replaceText = var1[1];
- this.findAgain();
- }
-
- }
-
- public void replaceAgain() {
- if (this.getSelectedText() != null && this.getSelectedText().equals(this.findText) && !this.setSelectedText(this.replaceText)) {
- ((Window)this).getToolkit().beep();
- }
-
- this.findAgain();
- }
- }
-